package com.bmf.module.examination.controller;


import com.bmf.module.examination.service.FixedTestQuestionService;
import com.bmf.module.examination.vo.FixedTestQuestionCreateVo;
import com.bmf.module.examination.vo.FixedTestQuestionResultVo;
import com.bmf.module.examination.vo.FixedTestQuestionUpdateVo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.List;
import java.util.Map;

import com.bmf.core.result.R;

/**
 * (FixedTestQuestion)表控制层
 *
 * @author makejava
 * @since 2023-01-03 10:12:25
 */
@RestController
@RequestMapping("fixedTestQuestion")
@Api(tags = {"固定试卷题目接口"})
public class FixedTestQuestionController{
    /**
     * 服务对象
     */
    @Autowired
    private FixedTestQuestionService fixedTestQuestionService;

    /**
     * 查询所有数据
     *
     * @return 所有数据
     */
    @PostMapping("/selectAll")
    @ApiOperation(value = "根据大题ids查询题目")
    public R<Map<String, List<FixedTestQuestionResultVo>>> selectAll(@RequestBody List<Integer> ids) {
        Map<String, List<FixedTestQuestionResultVo>> stringListMap = fixedTestQuestionService.selectAll(ids);
        return R.success(stringListMap);
    }


    /**
     * 新增数据
     *
     * @param fixedTestQuestionCreateVo 实体对象
     * @return 新增结果
     */
    @PostMapping
    @ApiOperation(value = "新增数据")
    public R<Void> insert(@RequestBody FixedTestQuestionCreateVo fixedTestQuestionCreateVo) {
        fixedTestQuestionService.insert(fixedTestQuestionCreateVo);
        return R.ok();
    }

    /**
     * 更新数据
     *
     * @param fixedTestQuestionUpdateVo 实体对象
     * @return 新增结果
     */
    @PutMapping
    @ApiOperation(value = "更新数据")
    public R<Void> update(@RequestBody FixedTestQuestionUpdateVo fixedTestQuestionUpdateVo) {
        fixedTestQuestionService.update(fixedTestQuestionUpdateVo);
        return R.ok();
    }


    /**
     * 删除数据
     *
     * @param ids 主键结合
     * @return 删除结果
     */
    @DeleteMapping("/delete")
    @ApiOperation(value = "删除数据")
    public R<Void> delete(@RequestBody List<Integer> ids) {
        fixedTestQuestionService.delete(ids);
        return R.ok();
    }
}

